package day1

import org.apache.spark.{SparkConf, SparkContext}

object WordCount_local {
  def main(args: Array[String]): Unit = {
    val sparkConf = new SparkConf()
    sparkConf.setMaster("local").setAppName("app1")
    val sc = new SparkContext(sparkConf)

    sc.textFile("hdfs://hdfs://hadoop10:9000/wc.txt")
      .flatMap(v=> v.split(" "))
      .map(v => (v,1))
      .groupBy(v => v._1)
      .map(v => (v._1,v._2.size))
      .saveAsTextFile("hdfs://hadoop10:9000/out4")

    sc.stop()
  }
}
